package com.mcr.graduateprogram.service.impl;

import com.alibaba.excel.EasyExcel;
import com.mcr.graduateprogram.bean.Gamekeys;
import com.mcr.graduateprogram.bean.KeysExcel;
import com.mcr.graduateprogram.filter.ExcelListener;
import com.mcr.graduateprogram.mapper.GamekeysMapper;
import com.mcr.graduateprogram.service.IGamekeysService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author graduateprogram
 * @since 2023-02-25
 */
@Service
public class GamekeysServiceImpl extends ServiceImpl<GamekeysMapper, Gamekeys> implements IGamekeysService {
    @Autowired
    private GamekeysMapper gamekeysMapper;
    @Autowired
    private ExcelListener excelListener;
    @Override
    public void ayalysisKeys(MultipartFile keysExcel) {
        try {
            EasyExcel.read(keysExcel.getInputStream(),KeysExcel.class,excelListener)
                    .sheet().doRead();
        } catch (Exception ioException) {
            ioException.printStackTrace();
        }
    }
}
